package com.zlm.tools.validation;

import org.quartz.xml.ValidationException;

/**
 * {@code }
 *
 * @author zlm
 * @since 2025/5/30
 */
public class MaxValidatorHandler implements ValidatorHandler{

    private final Integer max;
    public MaxValidatorHandler(Integer max) {
        this.max = max;
    }

    @Override
    public void validate(String filed,Object value, ValidatorContext context){
        if(value instanceof Integer){
            Integer intValue = (Integer) value;
            if(intValue > max){
                context.addError(filed +"值不能大于" + max);
                //context.stopChain();
            }
        }
        context.doNext(value);
    }
}
